    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <script type="text/javascript" src="js/bookLibBasic.js"></script>
    <script type="text/javascript" src="js/test.js"></script>
    <script type="text/javascript">
    window.onload = function(){
	userManager = new UserManager();
	bookManager = new BookManager();
	document.getElementById('result').innerHTML+="START:\n\n"
	test(userManager.addClient("mhwu","19900904BK201","巫明瀚","mhwu@hustunique.com"),-2);

	//start test
	//testing userManager
	test("start userManager",-2);
	
	test("test logout without login",-2);
	test(userManager.logout(),false);

	test("test checkoutlogin without login ",-2);
	test(userManager.checkLoginStatus(),false);

	test("test login with a registed username",-2);
	test(userManager.login("mhwu","19900904BK201"),true);

	test("test checkLoginStatus with logined",-2);
	test(userManager.checkLoginStatus(),true);

	test("test logout",-2);
	test(userManager.logout(),true);
	
	test("test addClient",-2);
	test(userManager.addClient("tester1","123456","测试员","tester@hustunique.com"),true);

	test("test login with none admin",-2);
	test(userManager.login("tester1","123456"),true);

	test("test isLogin attr",-2);
	test(userManager.isLogin,true);

	test("test getClienInfo with no username",-2);
	test(userManager.getClientInfo().username,-1);
	
	test("test getClientInfo with not this user username",-2);
	test(userManager.getClientInfo("mhwu").username,-1);

	test("test getClientInfo with this user username",-2);
	test(userManager.getClientInfo("tester1").username,-1);

	test("test getClientInfo with wrong username",-2);
	test(userManager.getClientInfo("wrongname").username,-1);

	
	//test BookManager unlogin
	test(userManager.logout(),-2);
	test("start BookManager:",-2);
	test("start unlogin test",-2);


	test("test getBookInfo",-2);
	test(bookManager.getBookInfo("S006"),null);

	test("test searchBooks",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook that not exist",-2);
	test(bookManager.delBook("S005"),false);

	test("test addBook",-2);
	test(bookManager.addBook("S005","AJAX编程实战高级教程","Design组","中国电子出版社"),false);

	test("test searchBook after add",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum after add",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook added befor",-2);
	test(bookManager.delBook("S005"),false);

	//test Login
	test("START login test",-2);
	test(userManager.logout(),-2);
	test(userManager.login("tester1","123456"),-1);

	test("test getBookInfo",-2);
	test(bookManager.getBookInfo("S006"),-1);

	test("test searchBooks",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook that not exist",-2);
	test(bookManager.delBook("S005"),false);

	test("test addBook",-2);
	test(bookManager.addBook("S005","AJAX编程实战高级教程","Design组","中国电子出版社"),false);

	test("test searchBook after add",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum after add",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook added befor",-2);
	test(bookManager.delBook("S005"),false);
	//test manager

	
	test("start Manager test",-2);
	test(userManager.logout(),-2);
	test(userManager.login("mhwu","19900904BK201"),-2);

	test("test getBookInfo",-2);
	test(bookManager.getBookInfo("S006"),-1);

	test("test searchBooks",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook that not exist",-2);
	test(bookManager.delBook("S005"),false);

	test("test addBook",-2);
	test(bookManager.addBook("S005","AJAX编程实战高级教程","Design组","中国电子出版社"),true);

	test("test searchBook after add",-2);
	test(bookManager.searchBooks("AJAX",1,10)[0].name,-1);

	test("test searchBooksNum after add",-2);
	test(bookManager.searchBooksNum("AJAX"),-1);

	test("test delBook added befor",-2);
	test(bookManager.delBook("S005"),true);;

	test("all  test done",-2);
	test("clean environment",-2);
	test(userManager.logout(),-2);

	alert("done");
	
    }
</script>
    </head>
    <body>
    <style type="text/css" media="screen">
      .red{
      color:red;
      font-size:20px;}
      .green{
      color:green;
      }
      .blue{
      color:blue;
      }
    </style>
result:
    <pre id="result">
    </pre>
    </body>
    </html>
